/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cx1.model.utils;

import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.cx1.model.PropertyType;

/**
 *
 * @author ECH
 */
public class KPropertyTypes {
    
    public static final PropertyType HOUSE = new PropertyType(KPropertyTypeIDs.HOUSE, "House", "", "");
    public static final PropertyType CONDOMINIUM = new PropertyType(KPropertyTypeIDs.CONDOMINIUM, "Condo", "", "");
    public static final PropertyType APARTMENT = new PropertyType(KPropertyTypeIDs.APARTMENT, "Apartment", "", "");
    public static final PropertyType TOWNHOUSE = new PropertyType(KPropertyTypeIDs.TOWNHOUSE, "Townhouse", "", "");
    public static final PropertyType ROOM = new PropertyType(KPropertyTypeIDs.ROOM, "", "Room", "");
        
    //CX: TODO: temporary service
    public static PropertyType getPropertyType(String id) {
        PropertyType propertyType = null;
        if (StringUtils.equals(id, KPropertyTypeIDs.HOUSE)) {
            propertyType = HOUSE;
        }
        else if (StringUtils.equals(id, KPropertyTypeIDs.CONDOMINIUM)) {
            propertyType = CONDOMINIUM;
        }
        else if (StringUtils.equals(id, KPropertyTypeIDs.APARTMENT)) {
            propertyType = APARTMENT;
        }
        else if (StringUtils.equals(id, KPropertyTypeIDs.TOWNHOUSE)) {
           propertyType = TOWNHOUSE;
        }
        else if (StringUtils.equals(id, KPropertyTypeIDs.ROOM)) {
            propertyType = ROOM;
        }
        return propertyType;
    }
        
    //CX: TODO: temporary service
    public static String getIDByTitle(String title) {
        String id = "";
        if (StringUtils.equalsIgnoreCase(title, HOUSE.getTitle())) {
            id = HOUSE.getId();
        }
        else if (StringUtils.equalsIgnoreCase(title, CONDOMINIUM.getTitle())) {
            id = CONDOMINIUM.getId();
        }
        else if (StringUtils.equalsIgnoreCase(title, APARTMENT.getTitle())) {
            id = APARTMENT.getId();
        }
        //else if (StringUtils.equalsIgnoreCase(title, TOWNHOUSE.getTitle())) {
        //    id = TOWNHOUSE.getId();
        //}
        else if (StringUtils.equalsIgnoreCase(title, ROOM.getTitle())) {
            id = ROOM.getId();
        }
        return id;
    }
        
    public static List<PropertyType> getAll() {
        List<PropertyType> propertyTypes = new ArrayList<PropertyType>();
        propertyTypes.add(HOUSE);
        propertyTypes.add(CONDOMINIUM);
        propertyTypes.add(APARTMENT);
        propertyTypes.add(ROOM);
        //propertyTypes.add(TOWNHOUSE);
        return propertyTypes;
    }
    
}
